module.exports = function (grunt) {

    var srcRoot = 'src/slide-view/';
    var buildRoot = 'build/slide-view/';

    grunt.file.setBase('../../');

    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    // grunt.loadNpmTasks('grunt-contrib-watch');
    
    grunt.initConfig({
        uglify: {
            options: {
                // banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
                //     '<%= grunt.template.today("yyyy-mm-dd") %> */'
                mangle: {
                    except: ['jQuery', 'Backbone', '*.min.js']
                }
            },
            dist: {
                files: {
                    'build/slide-view/js/slideView.js': [srcRoot + 'js/*.js']
                }
            }
        },
        copy: {
            // image: {
            //     files: [{
            //         expand: true,
            //         cwd: 'musician/src/images',
            //         src: ['*.png', '*.jpg', '*.jpeg', '*.gif'],
            //         dest: 'musician/build/images'
            //     }]
            // },
            html: {
                files: [{
                    expand: true,
                    cwd: srcRoot,
                    src: ['**/*.html'],
                    dest: buildRoot
                }]
            },
            css: {
                files: [{
                    expand: true,
                    cwd: srcRoot + 'css',
                    src: ['**/*.css'],
                    dest: buildRoot + 'css'
                }]
            }
            // js: {
            //     files: [{
            //         expand: true,
            //         cwd: srcRoot + 'js',
            //         src: ['**/*.min.js'],
            //         dest: buildRoot + 'js'
            //     }]
            // }
        },
        compass: {
            options: {
                sassDir: srcRoot + 'sass',
                cssDir: srcRoot + 'css',
                imagesDir: srcRoot + 'images',
                generatedImagesDir: buildRoot + 'images'
            },
            development: {
                options: {
                    debugInfo: true,
                    httpGeneratedImagesPath: ''
                }
            },
            production: {
                options: {
                    force: true,
                    outputStyle: 'compressed',
                    httpGeneratedImagesPath: ''
                }
            }
        },
        // watch: {
        //     options: {
        //         livereload: true,
        //         spawn: false
        //     },
        //     files: ['musician/src/**/*.scss', 'musician/src/**/*.js'],
        //     tasks: ['copy:js', 'compass:development']
        // }
    });
    
    // grunt.registerTask('default', ['copy:image', 'copy:js', 'compass:production']);
    // grunt.registerTask('development', ['copy:image', 'copy:js', 'compass:development', 'watch']);
    grunt.registerTask('default', ['uglify', 'compass:production', 'copy']);
    grunt.registerTask('dev', ['uglify', 'compass:development', 'copy']);
};